package com.otoe.dilidilivid.view.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.otoe.dilidilivid.adapter.FavoriteAdapter;
import com.otoe.dilidilivid.data.entity.FavoritesInfo;
import com.otoe.dilidilivid.R;

import java.util.ArrayList;
import java.util.List;

public class CollectionSelectActivity extends AppCompatActivity {
    private TextView cancelBtn;
    private TextView finishBtn;
    private RecyclerView recyclerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collection_select);
        cancelBtn = findViewById(R.id.tv_cancel);
        finishBtn = findViewById(R.id.tv_finish);

        List<FavoritesInfo> datas = initData();

        recyclerView = (RecyclerView) findViewById(R.id.collection_select_list);
        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
        recyclerView.setAdapter(new FavoriteAdapter(datas));

        cancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        finishBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }
    List<FavoritesInfo> initData(){
        List<FavoritesInfo> mdata = new ArrayList<FavoritesInfo>();
        int i=1,videoCover[]={R.drawable.video1,R.drawable.video2,R.drawable.video3,R.drawable.video4,R.drawable.video5, R.drawable.video6,R.drawable.video7,R.drawable.video8,R.drawable.video9,R.drawable.video10,R.drawable.video11, R.drawable.video12,R.drawable.video13,R.drawable.video14,R.drawable.video15,R.drawable.video16,R.drawable.video17, R.drawable.video18,R.drawable.video19,R.drawable.video20};
        mdata.add(new FavoritesInfo("收藏夹"+i,25,videoCover[9]));
        for(i=2;i<=4;i++){
            FavoritesInfo favoritesInfo = new FavoritesInfo();
            favoritesInfo.setName("收藏夹"+i);
            favoritesInfo.setSize((int)(Math.random()*1000));
            favoritesInfo.setShow(videoCover[i]);
            mdata.add(favoritesInfo);
        }
        return mdata;
    }
}